package Demo;
class Student{
    int age;
    String name;
    public Student(){
        System.out.println("调用了无参构造方法");
    }
    public Student(int age,String name){
        this();//用this调用了无参构造方法
        this.age=age;
        this.name=name;
        System.out.println("调用了有参构造方法");
    }
}
public class Test {
    public static void main(String[] args) {
        Student stu2=new Student(10,"zhangsn");
    }
}
